-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fillcache pkg: trigger cache update immediately #271
Merged
Jusshersmith
merged 7 commits into
master
from
jusshersmith-test-sso-fillcache-initial-cache
Dec 10, 2019
Merged
fillcache pkg: trigger cache update immediately #271
Jusshersmith
merged 7 commits into
master
from
jusshersmith-test-sso-fillcache-initial-cache
Dec 10, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jusshersmith
commented
Nov 21, 2019
Codecov Report
@@ Coverage Diff @@
## master #271 +/- ##
==========================================
+ Coverage 62.21% 62.54% +0.32%
==========================================
Files 54 54
Lines 4200 4202 +2
==========================================
+ Hits 2613 2628 +15
+ Misses 1399 1385 -14
- Partials 188 189 +1
|
Jusshersmith
commented
Nov 21, 2019
jphines
reviewed
Nov 26, 2019
jphines
previously approved these changes
Nov 26, 2019
Jusshersmith
force-pushed
the
jusshersmith-test-sso-fillcache-initial-cache
branch
from
December 9, 2019 17:09
b67d6ec
to
7165315
Compare
Now that #273 is merged, we're back and once again ✅! |
jphines
approved these changes
Dec 9, 2019
Jusshersmith
deleted the
jusshersmith-test-sso-fillcache-initial-cache
branch
December 10, 2019 12:16
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The fillcache package is what we use with the Google (and soon to be Cognito) providers to keep group membership cached.
Once a request goes through to
sso_auth
to validate a users group membership, theValidateGroup
function looks in the local cache for the relevant groups:sso/internal/auth/providers/google.go
Lines 366 to 370 in 14f2a96
If the group doesn't exist in the cache, it triggers a refresh of the cache which in turn kicks off a goroutine to keep the group cache up to date (based off an input TTL).
Right now, the triggered goroutine only fills the cache after the given TTL, not immediately. Any subsequent calls to
ValidateGroupMembership
between the first call, and the first tick ofttl
won’t have the groups cached.Solution
Break out the logic that the goroutine uses to fill the cache into a separate method, and call it once before the loop, and then upon each tick of
ttl
.Going to look at updating this PR with some logging examples to better verify the bug + expected behaviour
Notes